package com.yanqu.road.entity.activity.youxing;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_xing_you_user_data", desc = "行游山水玩家数据")
public class XingYouShanShuiUserData extends DataObject {

    @FieldTypeAnnotation(select = true, update = true, desc = "活动ID")
    private int activityId;

    @FieldTypeAnnotation(update = true, desc = "玩家ID")
    private long userId;

    @FieldTypeAnnotation(desc = "队伍总体力消耗")
    private int teamTotalEnergy;

    @FieldTypeAnnotation(desc = "队伍累计获得银票")
    private long teamTotalSilverCoin;

    @FieldTypeAnnotation(desc = "上次战力同步时间")
    private long lastAbilityUpload;

    @FieldTypeAnnotation(desc = "个人总体力消耗")
    private int totalEnergy;

    @FieldTypeAnnotation(desc = "个人累计获得银票")
    private long totalSilverCoin;

    @FieldTypeAnnotation(desc = "绕圈")
    private int round;

    @FieldTypeAnnotation(desc = "触发礼包MAP")
    private Map<Integer, XingYouUserMallData> mallDataMap = new ConcurrentHashMap<>();

    //cache
    private int groupId;

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getTeamTotalEnergy() {
        return teamTotalEnergy;
    }

    public void setTeamTotalEnergy(int teamTotalEnergy) {
        if(this.teamTotalEnergy != teamTotalEnergy) {
            this.teamTotalEnergy = teamTotalEnergy;
            setUpdateOption();
        }
    }

    public long getTeamTotalSilverCoin() {
        return teamTotalSilverCoin;
    }

    public void setTeamTotalSilverCoin(long teamTotalSilverCoin) {
        if(this.teamTotalSilverCoin != teamTotalSilverCoin) {
            this.teamTotalSilverCoin = teamTotalSilverCoin;
            setUpdateOption();
        }
    }

    public long getLastAbilityUpload() {
        return lastAbilityUpload;
    }

    public void setLastAbilityUpload(long lastAbilityUpload) {
        if(this.lastAbilityUpload != lastAbilityUpload) {
            this.lastAbilityUpload = lastAbilityUpload;
            setUpdateOption();
        }
    }

    public int getTotalEnergy() {
        return totalEnergy;
    }

    public void setTotalEnergy(int totalEnergy) {
        if(this.totalEnergy != totalEnergy) {
            this.totalEnergy = totalEnergy;
            setUpdateOption();
        }
    }

    public long getTotalSilverCoin() {
        return totalSilverCoin;
    }

    public void setTotalSilverCoin(long totalSilverCoin) {
        if(this.totalSilverCoin != totalSilverCoin) {
            this.totalSilverCoin = totalSilverCoin;
            setUpdateOption();
        }
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        if(this.round != round) {
            this.round = round;
            setUpdateOption();
        }
    }

    public Map<Integer, XingYouUserMallData> getMallDataMap() {
        return mallDataMap;
    }
    public void setMallDataMap(Map<Integer, XingYouUserMallData> mallDataMap) {
        if (null == mallDataMap){
            return;
        }
        if (this.mallDataMap == null || !this.mallDataMap.equals(mallDataMap)) {
            this.mallDataMap = mallDataMap;
            setOp(DataStatus.Update);
        }
    }

    public void addMallData(XingYouUserMallData mallData){
        if (mallData == null){
            return;
        }
        this.mallDataMap.put(mallData.getMallId(), mallData);
        setOp(DataStatus.Update);
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
}
